Skip to content

Enable ODBC Build On Linux - #160

Merged
alinaliBQ merged 12 commits into
apache-odbcfrom
linux-ci-build-new
Mar 19, 2026
Merged

Enable ODBC Build On Linux#160
alinaliBQ merged 12 commits into
apache-odbcfrom
linux-ci-build-new

Conversation

@alinaliBQ

@alinaliBQ alinaliBQ commented Mar 11, 2026

Copy link
Copy Markdown

Implements basic Linux build and unicode support is enabled. Tested locally and verified the driver can connect to DBT Labs via isql.

  • Enable Linux ODBC build with unicode support
  • Added docker-compose for Flight SQL ODBC
  • Register ODBC after build
  • Replaced boost::lexicographical_compare with std::lexicographical_compare
  • Fixed conversion bugs in SetAttributeSQLWCHAR

@alinaliBQ alinaliBQ closed this Mar 11, 2026
@alinaliBQ alinaliBQ reopened this Mar 11, 2026
@alinaliBQ
alinaliBQ force-pushed the linux-ci-build-new branch from d4e5463 to 8ac65b3 Compare March 12, 2026 19:26
@alinaliBQ
alinaliBQ marked this pull request as ready for review March 12, 2026 19:33
@alinaliBQ
alinaliBQ force-pushed the linux-ci-build-new branch from 8ac65b3 to 2afc5fd Compare March 12, 2026 19:35
- name: Register Flight SQL ODBC Driver
run: |
sudo cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh $(pwd)/build/cpp/${{ matrix.build-type }}/libarrow_flight_sql_odbc.dylib
sudo cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh $(pwd)/build/cpp/${{ matrix.build-type }}/libarrow_flight_sql_odbc.dylib

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want this same "Register Flight SQL ODBC Driver" section for linux as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is inside compose.yaml:

arrow/compose.yaml

Lines 531 to 535 in 2afc5fd

command: >
/bin/bash -c "
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so &&
/arrow/ci/scripts/cpp_test.sh /arrow /build"

Because Linux docker file has the test sessions etc inside the docker command, I added ODBC registration at the same place

Next: resolve the string conversion issues in tests. Write simple helper function to convert wstring (or wchar_t*) to `std::vector<SQLWCHAR>` should solve the issue.

Disable ODBC test build on Linux

- Building Linux test in ODBC will be in a separate PR
- Reducing dockerfile will be in a separate PR

Resolve sqlucode.h build issue

* Doesn't impact macOS. Check CI if it impacts Windows ODBC.

Resolve `sign-compare` warnings

- Need to have same type during comparison.
- Now `Built target arrow-odbc-spi-impl-test` is successful.

Add forward function header

Resolve system.cc build errors

Still have some wsigns stuff to fix later.

In-progress fix with unicode issues on system_dsn.cc

TODO - still need to make the `ToSqlWCharPtr` function safe.

Fix Linux build errors with configuration.cc

* Finish fixing wchar related build errors at configuration.cc
* Still have errors at `system_dsn.cc`

Remove some log messages

This partially reverts commit 568f72d.
All tests on macOS passing locally.

In-progress fix read SQLWCHAR string

In-progress Fix ODBC Build errors on Linux - Mar2 week

- Add `[[fallthrough]];` to indicate intentional fallthrough.
- Add `default` handling case.
- Add casts for `record_number` compares

Attempt to fix Windows build from odbc_statement.cc header change

In-progress Fix ODBC Build errors on Linux

- remove `std::move(options);`
- Remove `boost` library install and add boost::headers to cmake lists, which resolves a lot of the boost issues I think
- Continue on Monday.

Add wrappers for `reinterpret_cast<LPCWSTR>`

This was causing an issue on Linux

Replace `boost::lexicographical_compare` with `std::lexicographical_compare`

Restore boost usages and add `BOOST_NO_CXX98_FUNCTION_BASE`

Undo Set build level warning to production

It didn't resolve the build errors related to boost on Linux (or any other build errors)

Set build level warning to production

* If this acts as a workaround for boost, then we don't have to redo boost

In-progress Fix the `LPCWSTR` convert error on Linux

- Plus formatting fix
- Plus build fix for casting

More boost disables

I think the solution would be to replace boost completely. Now the build works on macOS.

Continue in-progress fix odbc build

Temp boost disables

In-progress fix ODBC build

- Add `unixodbc-dev` to dockerfile
- There are changes to macOS static build PR that I will need to incorporate back to `apache-odbc` later

Enable ODBC mac and Windows in case of errors

Enable ODBC build on Linux

Add ODBC=ON to dockerfile

Fix `arm64` cannot found error from typo

Add `DOCKER_VOLUME_PREFIX` and other environment settings

Add Linux docker to `compose.yaml`

Disable mac and Windows ODBC for faster build

More disable

Draft ODBC Linux implementation

Comment out non-ODBC items
* remove ODBC dockerfile as it is not needed.
* in-progress of register ODBC
* move unix odbc registration script to common place
* resolve the issue of ODBC APIs not exported on Linux
@alinaliBQ
alinaliBQ force-pushed the linux-ci-build-new branch from 2afc5fd to 126bbe7 Compare March 13, 2026 18:47
Trying to figure out why `Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION` just cannot pass default values. Somehow

Add configuration.cc logs

In-progress implement unicode support conversion

[In-progress] One change that (somehow) enables DBTLabs Flight SQL connection

- using `ENVID` as `static constexpr` enabled the environmentid variable to be read properly. Then other custom keys like `abc` and `Description` also started to work.

Fixes the issue of strings too
@alinaliBQ alinaliBQ changed the title Enable ODBC Build On Linux without unicode support Enable ODBC Build On Linux Mar 18, 2026
@@ -40,7 +40,16 @@ if [ ! -f "$ODBC_64BIT" ]; then
exit 1
fi

@alinaliBQ alinaliBQ Mar 19, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justing-bq this is the unix registration script

Comment thread compose.yaml
Comment on lines +531 to +535
command: >
/bin/bash -c "
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so &&
/arrow/ci/scripts/cpp_test.sh /arrow /build"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ODBC build, registration, and test is here

Comment on lines 17 to +19

// flight_sql_connection.h needs to be included first due to conflicts with windows.h
#include "arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.h"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For unicode support on Linux

Comment on lines +138 to +139
// Read keys before reading DSN. This is a workaround to unixodbc driver manager
// unable to read DSN keys

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo for myself change the comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


#pragma once

#define BOOST_NO_CXX98_FUNCTION_BASE // ARROW-17805

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed for build on Linux

}

// Reset GetData value offsets.
if (num_binding_ != get_data_offsets_.size() && reset_get_data_) {

@alinaliBQ alinaliBQ Mar 19, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo use const cast c++ style cast

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

EXPECT_FALSE(std::wstring(message).empty());
}

// TODO: verify that `SQLGetConnectOption` is not required by Excel.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed comment that should have been removed before

Comment on lines 261 to 263
endif()

add_test_case(${REL_TEST_NAME}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo undo this change

@alinaliBQ
alinaliBQ merged commit 17e312a into apache-odbc Mar 19, 2026
32 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants